require_relative 'tlv'
require_relative 'tag'

module SmppClient

  module Pdu

    module Tlv

      # The message_payload parameter contains the user data.
      # Value stored as ByteBuffer and accessed directly, cause it very complex..

      class MessagePayload < Tlv

        attr_accessor :value

        def initialize(arg)
          if arg.kind_of? ByteBuffer
            super(arg)
            @value = arg.remove_bytes(length)
          else
            super(Tag::MESSAGE_PAYLOAD)
            @value = arg
          end
        end

        def value_bytes
          @value
        end

      end

    end

  end

end